class Solution:
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        s = set()
        
        for n in nums:
            if n not in s:
                s.add(n)
            else:
                s.remove(n)

        return s.pop()

s = Solution()
print('ss', s.singleNumber([2,2,1]))
print('ss', s.singleNumber([4,1,2,1,2]))
